

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加修改</title>
    {include file="include/top"}
    <style>
        .layui-form-item .layui-input-inline{width: 80%;}
        #LAY_layedit_2{background: #fff;}
        .flex{display: flex;align-items: center;}
        .flex input{width: 50%;}
    </style>
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-app-form-tags" style="padding: 20px 0 0 0;">

    {include file="include/selectsearch" ctype='layui-form-item' title="渠道商" classname='fromID' optionHtml='<?php echo isset($fromID)?$fromID:"";?>' }
    {include file="include/input" class2='layui-form-item' type='text' title="三方ID" name='gasID' value='<?php echo isset($data["gasID"])?$data["gasID"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="名称" name='name' value='<?php echo isset($data["name"])?$data["name"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="省份" name='province' value='<?php echo isset($data["province"])?$data["province"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="省份编码" name='province_id' value='<?php echo isset($data["province_id"])?$data["province_id"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="城市" name='city' value='<?php echo isset($data["city"])?$data["city"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="城市编码" name='city_id' value='<?php echo isset($data["city_id"])?$data["city_id"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="区县" name='country' value='<?php echo isset($data["country"])?$data["country"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="地址" name='address' value='<?php echo isset($data["address"])?$data["address"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="坐标Lat" name='lat' value='<?php echo isset($data["lat"])?$data["lat"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="坐标Lng" name='lng' value='<?php echo isset($data["lng"])?$data["lng"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="服务" name='service' value='<?php echo isset($data["service"])?$data["service"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="开放时间" name='business_time' value='<?php echo isset($data["business_time"])?$data["business_time"]:"";?>'}
    {include file="include/input" class2='layui-form-item' type='text' title="星级" name='star' value='<?php echo isset($data["star"])?$data["star"]:"";?>'}
    <div class="layui-form-item">
        <label class="layui-form-label">油号</label>
        <div class="layui-input-inline">
            <input type="checkbox" lay-filter="oil_no" name="oil_no" value="92#" title="92#" <?php echo isset($data['prices']) && in_array("92#",$data['prices'])?'checked':'';?>>
            <input type="checkbox" lay-filter="oil_no" name="oil_no" value="95#" title="95#" <?php echo isset($data['prices']) && in_array("95#",$data['prices'])?'checked':'';?>>
            <input type="checkbox" lay-filter="oil_no" name="oil_no" value="98#" title="98#" <?php echo isset($data['prices']) && in_array("98#",$data['prices'])?'checked':'';?>>
            <input type="checkbox" lay-filter="oil_no" name="oil_no" value="0#" title="0#" <?php echo isset($data['prices']) && in_array("0#",$data['prices'])?'checked':'';?>>
        </div>
    </div>
    <span id="oil_no_92" <?php echo isset($data['prices']) && in_array("92#",$data['prices'])?'':'style="display: none;"';?>>
    <div class="layui-form-item">
        <label class="layui-form-label">92#</label>
        <div class="layui-input-inline layui-row">
            <div class="layui-col-xs4 flex">优惠价：<input type="number" name="price_yfq" value="{$data.pricesArr.a92?$data.pricesArr.a92.price_yfq:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">枪价：<input type="number" name="price_gun" value="{$data.pricesArr.a92?$data.pricesArr.a92.price_gun:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">发改委价：<input type="number" name="price_official" value="{$data.pricesArr.a92?$data.pricesArr.a92.price_official:''}" class="layui-input"></div>
        </div>
    </div>
    </span>
    <span id="oil_no_95"  <?php echo isset($data['prices']) && in_array("95#",$data['prices'])?'':'style="display: none;"';?>>
    <div class="layui-form-item">
        <label class="layui-form-label">95#</label>
        <div class="layui-input-inline layui-row">
            <div class="layui-col-xs4 flex">优惠价：<input type="number" name="price_yfq" value="{$data.pricesArr.a95?$data.pricesArr.a95.price_yfq:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">枪价：<input type="number" name="price_gun" value="{$data.pricesArr.a95?$data.pricesArr.a95.price_gun:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">发改委价：<input type="number" name="price_official" value="{$data.pricesArr.a95?$data.pricesArr.a95.price_official:''}" class="layui-input"></div>
        </div>
    </div>
    </span>
    <span id="oil_no_98"  <?php echo isset($data['prices']) && in_array("98#",$data['prices'])?'':'style="display: none;"';?>>
    <div class="layui-form-item">
        <label class="layui-form-label">98#</label>
        <div class="layui-input-inline layui-row">
            <div class="layui-col-xs4 flex">优惠价：<input type="number" name="price_yfq" value="{$data.pricesArr.a98?$data.pricesArr.a98.price_yfq:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">枪价：<input type="number" name="price_gun" value="{$data.pricesArr.a98?$data.pricesArr.a98.price_gun:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">发改委价：<input type="number" name="price_official" value="{$data.pricesArr.a98?$data.pricesArr.a98.price_official:''}" class="layui-input"></div>
        </div>
    </div>
    </span>
    <span id="oil_no_0"  <?php echo isset($data['prices']) && in_array("0#",$data['prices'])?'':'style="display: none;"';?>>
    <div class="layui-form-item">
        <label class="layui-form-label">0#</label>
        <div class="layui-input-inline layui-row">
            <div class="layui-col-xs4 flex">优惠价：<input type="number" name="price_yfq" value="{$data.pricesArr.a0?$data.pricesArr.a0.price_yfq:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">枪价：<input type="number" name="price_gun" value="{$data.pricesArr.a0?$data.pricesArr.a0.price_gun:''}" class="layui-input"></div>
            <div class="layui-col-xs4 flex">发改委价：<input type="number" name="price_official" value="{$data.pricesArr.a0?$data.pricesArr.a0.price_official:''}" class="layui-input"></div>
        </div>
    </div>
    </span>
    <div class="layui-form-item">
        <label class="layui-form-label">介绍</label>
        <div class="layui-input-inline">
            <textarea id="content" name="intro" lay-verify="intro" autocomplete="off" class="layui-textarea" style="display: none;">{$data.intro?$data.intro:''}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">三方状态</label>
        <div class="layui-input-inline">
            <select name="status" lay-search="" lay-filter="status" lay-search>
                <option value="1" <?php if(isset($data['status']) && $data['status']==1){ echo 'selected';}?>>正常营业</option>
                <option value="2" <?php if(isset($data['status']) && $data['status']==2){ echo 'selected';}?>>暂停营业</option>
                <option value="3" <?php if(isset($data['status']) && $data['status']==3){ echo 'selected';}?>>停止营业</option>
                <option value="4" <?php if(isset($data['status']) && $data['status']==4){ echo 'selected';}?>>建设中</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">本地状态</label>
        <div class="layui-input-inline">
            <select name="localStatus" lay-search="" lay-filter="localStatus" lay-search>
                <option value="1" <?php if(isset($data['localStatus']) && $data['localStatus']==1){ echo 'selected';}?>>正常</option>
                <option value="-1" <?php if(isset($data['localStatus']) && $data['localStatus']==-1){ echo 'selected';}?>>删除</option>
            </select>
        </div>
    </div>
</div>

{include file="include/js"}
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','form','layedit','upload'],function () {
        var $=layui.$;
        var form=layui.form;
        var upload = layui.upload
        var layedit = layui.layedit;
        // 图片接口放到建立编辑器前面，否则无效
        layedit.set({
            uploadImage: {
                url: '/users/uploadimg', //接口url
                type: 'post' //默认post
            }
        });
        form.on("checkbox(oil_no)",function (){
            var obj = $(this)
            var value = obj.val()
            $("#oil_no_"+value.replace(/^\#+|\#+$/g, '')).toggle()
        })
        // 设置编辑器
        layedit.build('content', {
            height: 500 //设置编辑器高度
            ,background:"#ffffff"
        });

        var index = layedit.build('content'); //建立编辑器
        form.verify({ // 这里就是把富文本数据同步到<textarea>中
            content: function (value) {
                return layedit.sync(index);
            }
        });
    });
</script>
</body>
</html>